{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1.【选择】以下代码可能的运行结果为：（ ）。\n",
    "```\n",
    "import random\n",
    "random.random()```\n",
    "A.1  \n",
    "B.4.063647000164759  \n",
    "C.0.09656393185717627  \n",
    "D.-0.885155622826353  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：C。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2.【选择】以下代码可能的运行结果为：（ ）。\n",
    "```\n",
    "import random\n",
    "random.randrange(0, 100, 2)```\n",
    "\n",
    "A.69   \n",
    "B.70     \n",
    "C.100      \n",
    "D.200"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：B。  \n",
    "解析：生成[0,100)以内的偶数。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "3.【选择】以下代码可能的运行结果为：（ ）。  \n",
    "```\n",
    "import random\n",
    "round(random.uniform(-101,101),3)```\n",
    "A.0   \n",
    "B.101  \n",
    "C.-6.007   \n",
    "D.11.070"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案:C。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "4.【填空】请根据程序的运行结果，推断程序空缺处a的最大值、b的最小值、c和d的值。  \n",
    "```\n",
    "import numpy as np\n",
    "x=rand.randint(a,b,(c,d))\n",
    "x```\n",
    "程序运行结果：\n",
    "```\n",
    "array([[-17,  17],\n",
    "       [-11, -16],\n",
    "       [ -9,  -3]])```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：-17；18；3；2。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "5.【填空】import numpy后，可以利用（ ）函数随机生成一个服从正态分布的实数数组，利用（ ）函数随机生成一个等距离数列。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：rand.randn()；np.linspace()。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "6.【填空】import random后，（ ）函数可用于设置随机数的种子数；在import numpy后，（ ）函数同样可以设置随机数的种子数。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：random.seed()；np.random.RandomState()。"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [default]",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
